<template>
    <main-page>
        <v-code-mirror v-model="code" :disabled="false" :theme="theme"></v-code-mirror>
    </main-page>
</template>

<script>


import VCodeMirror from "@/components/codemirror/index.vue";
import {ref, onMounted} from "vue";
import {service} from "@/utils";
import MainPage from "@/layout/other/MainPage.vue";

export default {
    name: "Test",
    components: {
        MainPage,
        VCodeMirror
    },
    setup(){
        const code = ref(`{"confTitle":"rulejar","confVersion":"202305101542","hdJarPath":"/jficsdata/icstest/rule/jar/rule-230510154224.jar"}`);


        onMounted(() => {
            service.get('actuator/logger', {lines: 500}).then(data => {
                if (data) {
                    const content = ref('')
                    data.forEach((item) =>{
                        // content.value += '<p>' + item + '</p>';
                        content.value += item + '\n';
                    })
                    code.value = content.value
                }
            })
        })
        const theme = ref({
            ".cm-line": {
                lineHeight: '28px',
            },
            '.cm-scroller': {
                fontSize: '15px',
                overflow: 'auto'
            },
        })
        return {
            code, options, theme
        }
    }
}
</script>

<style scoped>

</style>